#ifndef PROTOTYPE_PATTERN_H
#define PROTOTYPE_PATTERN_H

#include <string>

using namespace std;

class Prototype
{
public:
    virtual ~Prototype() {}

    virtual Prototype* clone() = 0;
    virtual string type() = 0;
};

class ProRectangle : public Prototype
{
public:
    ~ProRectangle() {}

    Prototype* clone() override;
    string type() override;
};

class ProCircle : public Prototype
{
public:
    ~ProCircle() {}
    Prototype* clone() override;
    string type() override;
};

class ShapeCache
{
private:
    static Prototype* shapeMap[2];
public:
    static Prototype* getShape(int shapeId);
    static void loadCache();
};

#endif // PROTOTYPE_PATTERN_H

/*
    Prototype* ShapeCache::shapeMap[2];

    Prototype* clonedShape1 = ShapeCache::getShape(0);

    std::cout << clonedShape1->type() << std::endl;
    delete clonedShape1;

    Prototype* clonedShape2 = ShapeCache::getShape(1);
    std::cout << clonedShape2->type() << std::endl;
    delete clonedShape2;
    */
